﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<ChoViet.Model.Menu>>" %>
<div class="mn_left">
    <div class="mn_left_top"><h3><%=Model.ToList().Count > 0 ? Html.Encode(Model.ToList()[0].ParentMenu!=null?Model.ToList()[0].ParentMenu.Name:string.Empty) : "Không xác định"%></h3></div>
    <div class="mn_left_body">        
        <ul class="menu_dvg">            
            <%string cClass = "active";
              var cUrl = Request.Url.PathAndQuery;
              foreach( var m in Model){
                  var current = cUrl == m.NavigateUrl ? cClass : string.Empty;
                  %>
                <li ><a class="<%=current%>" href="<%=m.NavigateUrl %>"><%=Html.Encode(m.Name) %></a>
                    <%var childs = m.ChildMenus.Where(e => e.PubYN == true).ToList();
                      if (childs.Count > 0)
                      { %>
                      <ul>
                        <%foreach (var c in m.ChildMenus)
                          {
                              var childcurrent = cUrl == c.NavigateUrl ? cClass : string.Empty;
                              %>
                          <li><a class="<%=childcurrent%>" href="<%=c.NavigateUrl %>"><%=Html.Encode(c.Name) %></a></li>
                        <%} %>
                      </ul>
                  <%} %>
                </li>
              <%} %> 
        </ul>
    </div>
    <div class="mn_left_buttom">&nbsp;</div>
</div>

